import h from './mySnabbdom/h'
import patch from './mySnabbdom/patch'

let container = document.getElementById('container');
let mybutton = document.getElementById('mybutton');

var vnode1 = h('div', { key: 'container2' }, '测试哦')

patch(container, vnode1)

var vnode2 = h('div', { key: 'container3' }, [
    h('p', {}, '哈哈'),
    h('p', {}, '嘻嘻'),
    h('p', {}, [
        h('ul', {}, [
            h('li', {}, '呵呵呵2'),
            h('li', {}, '呵呵呵3'),
            h('li', {}, '呵呵呵4'),
            h('li', {}, '呵呵呵5'),
        ])
    ]),
    h('p', {}, '么么哒'),
])

mybutton.onclick = function () {
    patch(vnode1, vnode2)
}



var obj = {};

Object.defineProperty(obj, 'a', {
    get: function () {
        console.log('get new value-- ', this)
    },
    set: function (newValue) {
        console.log('set new value-- ', newValue)
        console.log('set new value-- ', this)
        return 4
    }
})

window.myObj = obj

console.log('', obj.a)